package main

import (
	"time"
	"fmt"
)

func main() {
	// 循环某个时间间隔
	ticker := time.NewTicker(time.Second * 2)

	i := 0
	for {
		i++
		t := <-ticker.C
		fmt.Println(t)
		if 5 == i {
			ticker.Stop()
			break
		}
	}
}
